package com.base.cn.platform.os;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 省略了在主函数上添加 @EnableDiscoveryClient Spring Cloud默认认为客户端是要完成向注册中心进行注册的
 * 如果控制不需要向Eureka Server发起注册将该值设置为false,默认值为true; spring.cloud.service-registry.auto-registration.enabled = xxx
 */
@EnableFeignClients
@SpringBootApplication
@EnableAspectJAutoProxy(proxyTargetClass = true,exposeProxy = true)
@EnableAsync
@EnableScheduling //开启定时任务
@Slf4j
public class BaseServiceApplication extends SpringBootServletInitializer {
    public static void main( String[] args ){
        new SpringApplicationBuilder(BaseServiceApplication.class).web(WebApplicationType.SERVLET).run(args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(BaseServiceApplication.class);
    }
}
